<div>
	<button id="saveBtn">
		保存
	</button>
	<button id="usersBtn">
		所有用户
	</button>
</div>
<script type="text/javascript">
  var action = 'create';
</script>
<form id="roleForm">
<fieldset>
  <legend>角色编辑</legend>
	名称
	<input name="name" type="text" id="name" value="${bean.name}" />
	<#if bean.id??>
	   <input name="bean.id" type="hidden" value="${bean.id}"/>
	   <script type="text/javascript">
	      action = 'update';
	   </script>
	</#if>
</fieldset>
</form>
<script language="javascript">
   	$(function() {
        $("#saveBtn").click(function(){
        	saveRole();
        }).button();
         $("#usersBtn").click(function(){
        	
        }).button();
	});
	function saveRole() {
		if($("#name").val()=="")return;
		var postdata = $("#roleForm").serialize();
		
		$.ajax({
			type : "POST",
			url : 'admin/role/role!'+action,
			data : postdata,
			success : function(msg) {
				
			}
		});
	}
</script>